<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('出库单据历史列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>出库类型：</label>
                                <select name="inType" th:with="type=${@dict.getType('outtype')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>出库单据：</label>
                                <input type="text" name="stockoutId"/>
                            </li>
                            <li>
                                <label>出库子单：</label>
                                <input type="text" name="stockoutDetailId"/>
                            </li>
                            <li>
                                <label>物料编码：</label>
                                <input type="text" name="productId"/>
                            </li>

                            <li>
                                <label>规格：</label>
                                <input type="text" name="spec"/>
                            </li>

                            <li>
                                <label>创建时间：</label>
                                <input type="text"  placeholder="请选择起始时间" name="beginDate" id="beginDate"/>
                                ---
                                <input type="text"  placeholder="请选择结束时间" name="finishDate" id="finishDate"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId','bootstrap-table')"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('formId','bootstrap-table')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()"  >
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('search:viewoutfinish:edit')}]];
        var removeFlag = [[${@permission.hasPermi('search:viewoutfinish:remove')}]];
        var outTypeDatas = [[${@dict.getType('outtype')}]];
        var djstatus = [[${@dict.getType('dj_status')}]];
        var prefix = ctx + "search/viewoutfinish";

        layui.use('laydate', function () {
            var laydates = layui.laydate;
            laydates.render({
                elem: '#beginDate'
                , type: 'datetime',
                /* ,range: '到' */
                format: 'yyyy-MM-dd HH:mm:ss'
            })
        })

        layui.use('laydate', function () {
            var laydates = layui.laydate;
            laydates.render({
                elem: '#finishDate'
                , type: 'datetime',
                /* ,range: '到' */
                format: 'yyyy-MM-dd HH:mm:ss'
            })
        })

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "出库单据历史",
                clickToSelect: true,//是否启用点击选中行
                uniqueId:"stockoutId",//表主键(用于修改和删除)
                sortName:"stockoutId",//必加排序 sortOrder: "asc"默认
                columns: [
                    {
                        halign: 'center',
                        align:'center',
                        checkbox: true
                    },
                {
                    title: "序号",
                    halign: 'center',
                    align:'center',
                    width: 55,
                    formatter:function (value, row, index) {
                        //获取每页显示的数量
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;
                        //获取当前是第几页
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
                        //返回序号，注意index是从0开始的，所以要加上1
                        return pageSize * (pageNumber - 1) + index + 1;

                    }
                },

                {
                    field: 'stockoutId',
                    title: '出库单据',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'outType',
                    title: '出库类型',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(outTypeDatas, value);
                    }
                },
                {
                    field: 'createDate',
                    title: '创建时间',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'createManId',
                    title: '创建人',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                    {
                        field: 'createDate',
                        title: '创建时间',
                        halign: 'center',
                        align:'center',
                        sortable: true,
                        visible: true
                    },
                {
                    field: 'status',
                    title: '状态',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(djstatus, value);
                    }
                },
                {
                    field: 'stockoutSource',
                    title: '单据来源',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'exitId',
                    title: '出口',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },

                {
                    field: 'stockoutDetailId',
                    title: '出库子单据',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'productId',
                    title: '物料编码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'productName',
                    title: '物料名称',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'lotNo',
                    title: '批次',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'quantity',
                    title: '出库数',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'allotQuantity',
                    title: '完成数量',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'assignNum',
                    title: '分配数量',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'unitName',
                    title: '',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'erpStockoutId',
                    title: '',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'entryid',
                    title: '客户编号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'customerName',
                    title: '客户名称',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'spec',
                    title: '规格',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'mnemonicCode',
                    title: '漆面',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'specialFlag',
                    title: '属性1',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'productFlag',
                    title: '属性2',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'model',
                    title: '属性3',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'unit',
                    title: '属性4',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>